import Request from '@/utils/request'

/**
 * 获取问题整改用户身份部门列表
 * @param {Object} condition
 */
export function getUserDeptList (userid) {
  return new Request({
    url: 'sapi/rectify/getUserDeptList',
    method: 'get',
    params: {
      userid: userid
    }
  })
}

/**
 * 获取公司整改列表
 * @param condition
 * @returns {*}
 */
export function getCompanyRectifyList (condition) {
  return new Request({
    url: 'sapi/rectify/getCompanyRectifyList',
    method: 'post',
    data: condition
  })
}

/**
 * 获取单位整改列表
 * @param condition
 * @returns {*}
 */
export function getDeptRectifyList (condition) {
  return new Request({
    url: 'sapi/rectify/getDeptRectifyList',
    method: 'post',
    data: condition
  })
}

/**
 * 批量审核提交
 * @param condition
 * @returns {*}
 */
export function batchRectifyApprove (condition) {
  return new Request({
    url: 'sapi/rectify/batchRectifyApprove',
    method: 'post',
    data: condition
  })
}

/**
 * 获取单位名称获取单位下一级部门列表
 * @param currentDepartment
 * @returns {*}
 */
export function getDutyDeptList (currentDepartment) {
  return new Request({
    url: 'sapi/rectify/getDutyDeptList',
    method: 'get',
    params: {
      user_dept: currentDepartment
    }
  })
}

/**
 * 更新整改信息（公司）
 * @param formData
 * @returns {*}
 */
export function updateCompanyRectifyProblem (formData) {
  return new Request({
    url: 'sapi/rectify/updateCompanyRectifyProblem',
    method: 'post',
    data: formData
  })
}

/**
 * 更新整改信息（单位）
 * @param formData
 * @returns {*}
 */
export function updateDeptRectifyProblem (formData) {
  return new Request({
    url: 'sapi/rectify/updateDeptRectifyProblem',
    method: 'post',
    data: formData
  })
}

/**
 * 根据问题ID获取历史记录
 * @param currentDepartment
 * @returns {*}
 */
export function getRectifyHistory (id) {
  return new Request({
    url: 'sapi/rectify/getRectifyHistory',
    method: 'get',
    params: {
      id: id
    }
  })
}

/**
 * 批量指定责任部门
 * @param params
 * @returns {*}
 */
export function batchRectifyDuty (params) {
  return new Request({
    url: 'sapi/rectify/batchRectifyDuty',
    method: 'post',
    data: params
  })
}
